Repository navigation
Conversation
Contributor
|
Fix looks good to me but we should have a test added to avoid this issue regressing in the future. |
A gradient or pattern that references another one through `href`/`xlink:href` did not inherit its `gradientTransform` or `patternTransform`. Stops, coordinates, units and `spreadMethod` were inherited, but the transform was silently dropped. For example, `<linearGradient id="lg2" xlink:href="#lg1"/>`, where `lg1` has `gradientTransform="rotate(90 0.5 0.5)"`, rendered left-to-right instead of top-to-bottom, and a referencing pattern lost its rotation. This is a regression from 9101f30 ("Add support for the `transform-origin` attribute"), which replaced `resolve_attr(node, AId::GradientTransform).attribute(..)` with `node.resolve_transform(..)`. `resolve_transform` only reads the attribute from the element itself, so the `GradientTransform` entries in `resolve_lg_attr` and `resolve_rg_attr` became unused. SVG 2 lists `gradientTransform` among the attributes copied from a template `linearGradient` or `radialGradient`, and `patternTransform` among those copied from a template `pattern` (https://www.w3.org/TR/SVG2/pservers.html). SVG 1.1 likewise states that attributes defined on the referenced element but not on this element are inherited. Resolve the element that defines the transform with `resolve_attr` before calling `resolve_transform`, in `convert_linear`, `convert_radial` and `convert_pattern`. A transform set on the element itself still takes precedence over the referenced one. Signed-off-by: killerdevildog <quaylynrimer11@gmail.com> Signed-off-by: killerdevildog <software.quaylynrimer@gmail.com>
LaurenzV
force-pushed
the
fix-inherit-paint-server-transform-via-href
branch
from
October 3, 2026 06:49
d70feeb to
268a26d
Compare
Collaborator
|
Thanks! |
dmtrKovalenko
pushed a commit
to dmtrKovalenko/svgr
that referenced
this pull request
Oct 13, 2026
…ref` (linebender#1135) Upstream: linebender/resvg@1fe3cfe Applied as-is (paths mapped to crates/usvgr and crates/svgr/tests). No new tree fields, so no cache/hash or svgtree proc-macro impact. (cherry picked from commit 1fe3cfe)
HiroyukiFuruno
added a commit
to HiroyukiFuruno/katana-resvg
that referenced
this pull request
Oct 25, 2026
* Update Windows release runner to `windows-latest` (linebender#1113) * c-api: add missing SVGZ error enum (linebender#1122) Add the missing `RESVG_ERROR_SVGZ_UNSUPPORTED` enum value to `resvg.h` so the C API enum values remain in sync with the Rust definition and subsequent error codes are not shifted. While we're here, simplify this enum description (as the `svgz` feature is enabled by default) and add the corresponding Qt error string in `ResvgQt.h`. Fixes: linebender#1112. --- Verified against wasm-vips with this sed substitution: https://github.com/kleisauke/wasm-vips/blob/8f38cbbb70d7536bd0f3d70e308c501cbe4f2e22/build.sh#L442-L443 * Add regression test for `fr` resolution in referenced radial gradients (linebender#1123) As requested in linebender#1098 * fix(usvg): use the viewport as the bbox of a sliced <image> (linebender#1077) * Add aarch64 release artifacts for Linux and Windows (linebender#1132) Adds native aarch64 builds to the release workflow. - **Linux aarch64** on the `ubuntu-24.04-arm` runner → `resvg-linux-aarch64.tar.gz`, `usvg-linux-aarch64.tar.gz` - **Windows aarch64** on the `windows-11-arm` runner → `resvg-win-aarch64.zip`, `usvg-win-aarch64.zip` Updates the workflow's actions, two of which still declared the end-of-life node12 runtime: - `alexellis/upload-assets` 0.2.2 → 0.5.0 (node12 → node24) - `battila7/get-version-action` removed — unmaintained since 2021 and node12; the workflow only triggers on `v*` tags, so the version is just `${GITHUB_REF_NAME#v}` - `actions/checkout` v2 → v7, `softprops/action-gh-release` v2 → v3 Renames the existing job to explicitly say `x86_64` and differentiate `aarch64` Closes linebender#968 * Convert CI release job to use a Matrix (linebender#1133) Some CI cleanup suggested by LLM review of linebender#1132. Has been verified as working on my fork. ## Changes made - Collapse the six per-platform release-* jobs into one release-binaries matrix job over {linux, win, macos} × {x86_64, aarch64}. Asset names are derived from the matrix (`resvg-$SUFFIX.{tar.gz,zip}`). This renamea `resvg-win64.zip` / `usvg-win64.zip` to `resvg-win-x86_64.zip` / `usvg-win-x86_64.zip` to match the linux-* / macos-* / win-aarch64 naming. This is a breaking change for anyone scripting downloads of the old names. - Drop the crates/c-api release builds (and the ilammy/msvc-dev-cmd step): their output was never collected or uploaded, so they only cost CI time. - Split the vendored sources archive and the Windows Explorer thumbnailer into their own jobs - Upload assets with `softprops/action-gh-release@v3` files: (already used to create the release) instead of the third-party `alexellis/upload-assets`. * tests: load test fonts in a deterministic order (linebender#1136) `fontdb::load_fonts_dir` walks the directory with `std::fs::read_dir`, which outputs entries in filesystem order. That order is not stable across machines, and the test harness depends on it. Replace `load_fonts_dir` with an explicit sorted list so order is identical everywhere. The whole suite passes unchanged, so no stored reference image depended on the previous ordering. * fix(usvg): inherit `gradientTransform` and `patternTransform` via `href` (linebender#1135) * Inherit `dominant-baseline` into nested `<tspan>` elements (linebender#1086) * Fix bug in filter chains with different filter regions (linebender#1144) * Add support for `plus-lighter` and `lighter` (linebender#1142) * Apply root SVG transform after the `viewBox` mapping (linebender#1085) * Add `--query-bbox` to CLI (linebender#1050) * Support floating point viewbox in resvg binary (linebender#875) * Fix `feMorphology` kernel size and radius rounding (linebender#1120) * Bug fixes for RTL text and `dx`/`dy` (linebender#1145) * Fix font fallback logging and avoid repeated lookups (linebender#1154) * Fix rendering of filters with skews and rotations (linebender#1155) * Fix marker viewport clipping with preserveAspectRatio (linebender#1163) * Resolve paint servers in masks, patterns and `feImage` before caching (linebender#1164) * Optimize clipped layers (linebender#1158) * Remove reference to nonexistent check.py from tests README (linebender#1181) * Install ResvgQt.h with cargo-c (linebender#1182) * Prepare v0.49.0 release (linebender#1183) * fix: Windowsサムネイルの依存版を0.49へ揃える Refs #1 --------- Co-authored-by: TheBestWebsite <164817940+TheBestWebsite@users.noreply.github.com> Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl> Co-authored-by: Tim Voßhenrich <94936637+T1mVo@users.noreply.github.com> Co-authored-by: Stefano <stefano.d@posteo.de> Co-authored-by: Chongyi Zheng <git@zcy.dev> Co-authored-by: Nico Burns <nico@nicoburns.com> Co-authored-by: Luis de Bethencourt <luis@debethencourt.com> Co-authored-by: Quaylyn Rimer <31830590+killerdevildog@users.noreply.github.com> Co-authored-by: Teo Mal <76534902+teolines@users.noreply.github.com> Co-authored-by: Matt Hargett <plaztiksyke@gmail.com> Co-authored-by: Simon Ser <contact@emersion.fr> Co-authored-by: Jeremy James <jeremy.james@gmail.com> Co-authored-by: WaterWhisperer <waterwhisperer24@qq.com> Co-authored-by: Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> Co-authored-by: Cees-Kettenis <101450983+Cees-Kettenis@users.noreply.github.com> Co-authored-by: Rodrigue Villetard <rodrigue@gassagosso.coop>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1134.
A gradient or pattern that references another one through
hrefdid not inherit itsgradientTransformorpatternTransform. For example,<linearGradient id="lg2" xlink:href="#lg1"/>, wherelg1hasgradientTransform="rotate(90 0.5 0.5)", rendered left to right instead of top to bottom.This regressed in 9101f30 (first released in v0.37.0), which replaced
resolve_attr(node, AId::GradientTransform).attribute(..)withnode.resolve_transform(..)to supporttransform-origin.resolve_transformonly reads the element itself, so thehreflookup was lost and theGradientTransformentries inresolve_lg_attrandresolve_rg_attrbecame unused. Resolving the defining element withresolve_attrfirst restores inheritance and keepstransform-originsupport. A transform set on the element itself still takes precedence. When the transform is inherited,transform-originis read from the same element that defines the transform.This PR changes only
crates/usvg/src/parser/paint_server.rs.Validation: the reproducer from #1134 fails before the change and passes afterward; resvg's output now matches rsvg-convert 2.58 to within 1/255 per color channel (before the change it differed by up to 255). Local paired cases covering linear, radial and pattern templates, a radial gradient using a linear template, a two-level
hrefchain, and an element that overrides the inherited transform each render pixel-identically to the same transform set directly on the element.cargo test --release -p resvg -p usvgpasses (1731 integration tests, no reference image changes) andcargo fmt --checkis clean. The local regression tests are not included in this PR. Tested on Linux only.